

Ext.define('pf.common.BookshelfItem', {
    extend: 'Ext.data.Model',
    fields: [ 'name', 'author', 'url' ]
});

Ext.define('pf.contentCards.Bookshelf', {
    itemId: 'bookshelf',
    requires: ['pf.common.BookshelfItem'],
	extend: 'Ext.panel.Panel',
	layout: {
		type: 'vbox',
		align: 'stretch'
	},
	title: 'Bookshelf',
	
	items: [{
		xtype: 'box',
//		flex: 1,
//		height: 20,
		html: 'I love reading! I confess to being a bit of a bookworm, who would rather spend Friday evenings with Fyodor Dostoyevsky ' + 
		  	  'than go bar hopping or dancing in the clubs. I own an ' +
		  	  '<a href="http://www.amazon.com/Kindle-Wireless-Reader-Wifi-Graphite/dp/B002Y27P3M/ref=sr_1_2?s=digital-text&ie=UTF8&qid=1338740528&sr=1-2">' +
		  	  'Amazon Kindle</a>, which I think is the best tech gadget investment I\'ve ever made. I thought this would be a nice place to ' +
		  	  'keep track of all the books I\'ve read and those that are on my wish list.'
	}, {
	    xtype: 'tabpanel',
//	    layout: 'tab',
	    flex: 1,
	    activeTab: 0,
	    items: [
	    	Ext.create('Ext.grid.Panel', {
	    	    title: 'Currently Reading',
	    	    store: Ext.create('Ext.data.Store', {
	    	        autoLoad: true,
	    	        proxy: {
	    	            type: 'ajax',
	    	            url: 'resources/json/books.json',
//	    	            url: 'get-images.php',
	    	            reader: {
	    	                type: 'json'
//	    	                root: 'images',
//	    	                idProperty: 'name'
	    	            }
	    	        },
	    	        model: 'pf.common.BookshelfItem'
//	    	        reader: {
//	    	            type: 'json',
//	    	            root: 'books'
//	    	        }
	    	    }),
	    	    columns: [
	    	        { header: 'Name',  dataIndex: 'name', flex: 1 },
	    	        { header: 'Author', dataIndex: 'author', flex: 1 }
	    	    ],
	    	    height: 200,
	    	    width: 400
	    	}),
	        {
    	    	title: 'Read: Fiction'
    	    },
    	    {
    			title: 'Read: Non-fiction'
    		}, 
    		{
    	    	title: 'Wishlist'
    	    }
    	]
	}]
	
});